package com.common.widget;


import android.text.method.PasswordTransformationMethod;
import android.view.View;

/**
 * 登录及注册页面的密码输入框，输入后用 * 号代替，以解决部分机型兰亭序字体下无法显示圆点问题
 * 
 * <br>Created 2014-8-19 下午2:57:30
 * @version  V1.3
 * @author   linsj		
 *
 * @see 	 
 * 
 * Copyright(c) 2009-2014, TQ Digital Entertainment, All Rights Reserved
 *
 */
public class LoginPasswordTransformationMethod extends PasswordTransformationMethod {
    @Override
    public CharSequence getTransformation(CharSequence source, View view) {
        return new PasswordCharSequence(source);
    }

    /**
     * 字符替换类
     * 
     * <br>Created 2014-8-19 下午2:58:42
     * @version  LoginPasswordTransformationMethod
     * @author   linsj		
     *
     * @see 	 
     * 
     * Copyright(c) 2009-2014, TQ Digital Entertainment, All Rights Reserved
     *
     */
    private class PasswordCharSequence implements CharSequence {
        private CharSequence mSource;
        public PasswordCharSequence(CharSequence source) {
            mSource = source; // Store char sequence
        }
        public char charAt(int index) {
            return '*'; // This is the important part
        }
        public int length() {
            return mSource.length(); // Return default
        }
        public CharSequence subSequence(int start, int end) {
            return mSource.subSequence(start, end); // Return default
        }
    }
};
